﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BarberShop.BLL;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //if (IsPostBack)
        //{
        LoginPost();
        //}
    }

    protected void btn_login_Click(object sender, EventArgs e)
    {
        Response.Redirect("Main/index.htm");
    }
    protected void LoginPost()
    {
        string username = Request.Form["txt_username"];
        string pwd = Request.Form["txt_pwd"];
        var r = UserInfoBLL.ValidateUser(username, pwd);
        r = true;
        if (r)
        {
            Session["username"] = "xxx";
            Response.Redirect("Main/index.htm");
        }
        else
        {
            Response.Write("<script type='text/javascript'>alert('用户名或密码错误！');</script>");
            //ClientScript.RegisterStartupScript(this.GetType(), "", "<script type='text/javascript'>alert('用户名或密码错误！');</script>");
        }
    }
}
